<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
    <head>

        <meta http-equiv="content-language" content="sk" />
        <meta http-equiv="cache-control" content="no-cache" />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>BMB Leitner CS</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    <body>
        <?php
        include "inc/db_connect.php";
        include "inc/functions.php";
        //session_start();
        echo '<a class="backHref" href="home.php?akc=4" title="">Späť</a>';
        if (isset($_GET['week']) && isset($_POST['mode']) && isset($_POST['zero'])) {
            if ($_POST['mode'] == 'week') {
                $tyzden = $_GET['week'];
                $bodNula = $_POST['zero'];
                $user_id = $_POST['user'];
                $veduci_oddelenia = $_POST['veduci'];
                //
                ?>

        <table style="border-collapse: collapse; font-size: 14px;text-align: center; vertical-align: middle; width: 1450px;">
            <tr>
                        <?php
                        for ($i=0;$i<23;$i++) {
                            echo '<td style="width:65px; height: 0px;"></td>';
                        }
                        ?>
            </tr>
            <tr>
                <td colspan="2" rowspan="2" style="text-align: left"><img src="images/falkLogo.png" title="" alt="" width="60" height="60" />&nbsp;1.strana</td>
                <td colspan="21">
                            <?php
                            $odd_s = "SELECT * FROM oddelenie WHERE id='".$veduci_oddelenia."' ";
                            $odd_q = MySQL_Query ($odd_s);
                            $odd = MySQL_Fetch_Array($odd_q);
                            echo '<span style="font-size: 20px;">Oddelenie: <b>'.$odd['nazov'].'</b></span>';
                            ?>
                </td>
            </tr>
            <tr>
                <td colspan="21">
                            <?php echo '<h3>Týždeň od '.date("d/m/Y",($bodNula + ($tyzden-1)*(7*24*60*60))).' do '.date("d/m/Y",($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) )).'</h3>'; ?>
                </td>
            </tr>
            <tr>
                        <?php
                        for ($i=0;$i<23;$i++) {
                            echo '<td style="width:65px; height: 10px;"></td>';
                        }
                        ?>
            </tr>
            <tr style="background: #e4c9ff">
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="2">Meno</th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Nočných k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Sviatkov k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Strava k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Nadčas k <?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) )); ?> </th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Mod k <?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) )); ?> </th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">&nbsp;</th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) )) ?></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">PODPIS NADRIADENÉHO</th>
            </tr>
            <tr style="background: #e4c9ff">
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
            </tr>
            <tr>
                        <?php
                        for ($i=0;$i<23;$i++) {
                            echo '<td style="width:65px; height: 5px;"></td>';
                        }
                        ?>
            </tr>
                    <?php
                    $zam_s = "SELECT * FROM z WHERE patri_k='".$veduci_oddelenia."' ORDER BY poradie";
                    $zam_q = MySQL_Query ($zam_s);
                    $iii = 0;
                    $iiii = 0;
                    $strana = 1;
                    while ($zam = MySQL_Fetch_Array($zam_q)) {
                        $odchod = explode('-', $zam['datum_odchodu']);
                        $prichod = explode('-', $zam['datum_prichodu']);
                        if ( (((date("U",mktime(0,0,0,$odchod[1],$odchod[2],$odchod[0])))>=($bodNula + ($tyzden-1)*(7*24*60*60)))||($zam['datum_odchodu']=='0000-00-00')) && ((date("U",mktime(0,0,0,$prichod[1],$prichod[2],$prichod[0])))<=($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60))) ) {

                            $iii++;
                            $iiii++;
                            if ($iiii>7) {
                                $iiii = 0;
                                $strana ++;
                                ?>
            <tr>
                                    <?php
                                    for ($i=0;$i<23;$i++) {
                                        echo '<td style="width:65px; height: 110px;"></td>';
                                    }
                                    ?>
            </tr>
            <tr>
                <td colspan="2" rowspan="2" style="text-align: left"><img src="images/falkLogo.png" title="" alt="" width="60" height="60" />&nbsp;<?php echo $strana ?>.strana</td>
                <td colspan="21">
                                        <?php
                                        $odd_s = "SELECT * FROM oddelenie WHERE id='".$veduci_oddelenia."' ";
                                        $odd_q = MySQL_Query ($odd_s);
                                        $odd = MySQL_Fetch_Array($odd_q);
                                        echo '<span style="font-size: 20px;">Oddelenie: <b>'.$odd['nazov'].'</b></span>';
                                        ?>
                </td>
            </tr>
            <tr>
                <td colspan="21">
                                        <?php echo '<h3>Týždeň od '.date("d/m/Y",($bodNula + ($tyzden-1)*(7*24*60*60))).' do '.date("d/m/Y",($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) )).'</h3>'; ?>
                </td>
            </tr>
            <tr>
                                    <?php
                                    for ($i=0;$i<23;$i++) {
                                        echo '<td style="width:65px; height: 10px;"></td>';
                                    }
                                    ?>
            </tr>
            <tr style="background: #e4c9ff">
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="2">Meno</th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Nočných k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Sviatkov k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Strava k <span class="mesiacRok"><?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60))) ?></span></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Nadčas k <?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) )); ?> </th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">Mod k <?php echo date("d.m. Y",($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) )); ?> </th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">&nbsp;</th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) )) ?></th>
                <th style="border: 1px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="2"><?php echo date("d-M",($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) )) ?></th>
                <th style="border: 1px solid black; border-bottom: 3px solid black;" rowspan="2" colspan="1">PODPIS NADRIADENÉHO</th>
            </tr>
            <tr style="background: #e4c9ff">
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (0*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (1*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (2*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (3*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (4*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (5*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">príchod</td>
                <td style="border: 1px solid black; border-bottom: 3px solid black<?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + (6*24*60*60) ))) echo '; border: 3px solid olive' ?>" rowspan="1" colspan="1">odchod</td>
            </tr>
            <tr>
                                    <?php
                                    for ($i=0;$i<23;$i++) {
                                        echo '<td style="width:65px; height: 5px;"></td>';
                                    }
                                    ?>
            </tr>
                                <?php
                            }
                            ?>
            <tr style="background:<?php if ($iii%2 == 0) {
                                echo '#ffffff';
                            } else {
                                echo '#eaeaea';
                                } ?>">
                <td style="border: 1px solid black; border: 3px solid <?php if ($zam['manager']==1) echo 'teal'; elseif($zam['manager']==0) echo 'gray'; else echo 'olive' ?>; color: <?php if ($zam['manager']==1) echo 'teal'; else echo 'gray' ?>" rowspan="3" colspan="2"><?php echo $zam['meno'] .' '. $zam['priezvisko'] ?></td>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="nocna<?php echo $zam['id'] ?>">
                                    <?php
                                    if ($zam['manager']!=1) {
                                        $vypis = 0;
                                        $sum = vypocitajFinalnyNocnyKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) ));
                                        $vypis += $sum;
                                        echo $vypis;
                                    } else {
                                        echo '-';
                                    }
                                    ?>
                </td>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="sviatok<?php echo $zam['id'] ?>">
                                    <?php
                                    if ($zam['manager']!=1) {
                                        $vypis = 0;
                                        $sum = vypocitajFinalnySviatokKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) ));
                                        $vypis += $sum;
                                        echo $vypis;
                                    } else {
                                        echo '-';
                                    }
                                    ?>
                </td>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="strava<?php echo $zam['id'] ?>">
                                    <?php
                                    $vypis = 0;
                                    $vypis += vypocitajFinalnuStravuKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) ));
                                    echo $vypis;
                                    ?>
                </td>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="nadcas<?php echo $zam['id'] ?>">
                                    <?php
                                    if ($zam['manager']!=2) {
                                        $vypis = 0;
                                        $sum = vypocitajFinalnyNadcasKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (1*24*60*60) ));
                                        $vypis += $sum;
                                        echo $vypis;
                                    } else {
                                        $vypis = 0;
                                        $sum = pocetOdpracovanychHodinKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (1*24*60*60) ));
                                        $vypis += $sum;
                                        echo $vypis;
                                    }
                                    ?>
                </td>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="mod<?php echo $zam['id'] ?>">
                                    <?php
                                    if ($zam['manager']==1) {
                                        $vypis = 0;
                                        $sum = vypocitajFinalnyModKtyzdnu($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) - (24*60*60) ));
                                        $vypis += $sum;
                                        echo $vypis;
                                    } else {
                                        echo '-';
                                    }
                                    //echo vypocitatMOD($zam['id'], $bodNula + ($tyzden-1)*(7*24*60*60));
                                    ?>
                </td>
                <td style="border: 1px solid black; height: 35px" rowspan="1" colspan="1">plánované</td>
                                <?php
                                for ($l=0;$l<7;$l++) {
                                    $in = typDochadzky($zam['id'],($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)));
                                    if ($in=='SPL')
                                        $h = 35;
                                    else
                                        $h = 20;
                                    ?>
                <td style="border: 1px solid <?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60) ))) echo 'olive'; else echo 'black'; ?>" rowspan="1" colspan="1" class="day<?php echo $zam['id'] ?><?php echo ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)) ?>"><?php if ($in!='P') echo '<img src="images/'.$in.'.png" title="" alt="" width="65" height="'.$h.'" />'; else echo vyplnenyCas($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)), 1)  ?></td>
                <td style="border: 1px solid <?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60) ))) echo 'olive'; else echo 'black'; ?>" rowspan="1" colspan="1" class="day<?php echo $zam['id'] ?><?php echo ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)) ?>"><?php if ($in!='P') echo '<img src="images/'.$in.'.png" title="" alt="" width="65" height="'.$h.'" />'; else echo vyplnenyCas($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)), 2)  ?></td>
                                    <?php
                                }
                                ?>
                <td style="border: 2px solid black;" rowspan="3" colspan="1" id="">
                </td>
            </tr>
            <tr style="background:<?php if ($iii%2 == 0) {
                                echo '#ffffff';
                            } else {
                                echo '#eaeaea';
                                } ?>">
                <td style="border: 1px solid black; height: 35px" rowspan="1" colspan="1"><b>reálne</b></td>
                                <?php
                                for ($l=0;$l<7;$l++) {
                                    $in = typDochadzky($zam['id'],($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)));
                                    ?>
                <td style="border: 1px solid <?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60) ))) echo 'olive'; else echo 'black'; ?>" rowspan="1" colspan="1" class="day<?php echo $zam['id'] ?><?php echo ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)) ?>"><?php if (($in!='P')&&($in!='SPL')) echo '<img src="images/'.$in.'.png" title="" alt="" width="65" height="20" />'; else echo vyplnenyCas($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)), 3)  ?></td>
                <td style="border: 1px solid <?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60) ))) echo 'olive'; else echo 'black'; ?>" rowspan="1" colspan="1" class="day<?php echo $zam['id'] ?><?php echo ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)) ?>"><?php if (($in!='P')&&($in!='SPL')) echo '<img src="images/'.$in.'.png" title="" alt="" width="65" height="20" />'; else echo vyplnenyCas($zam['id'], ($bodNula + ($tyzden-1)*(7*24*60*60) + ($l*24*60*60)), 4)  ?></td>
                                    <?php
                                }
                                ?>
            </tr>
            <tr style="background:<?php if ($iii%2 == 0) {
                                echo '#ffffff';
                            } else {
                                echo '#eaeaea';
                                } ?>">
                <td style="border: 1px solid black;height: 35px" rowspan="1" colspan="1"><b>PODPIS</b></td>
                                <?php
                                for ($k=0;$k<7;$k++) {
                                    ?>
                <td style="border: 1px solid <?php if (jeSviatok(($bodNula + ($tyzden-1)*(7*24*60*60) + ($k*24*60*60) ))) echo ' olive'; else echo 'black;' ?>" rowspan="1" colspan="2">

                </td>
                                    <?php
                                }
                                ?>
            </tr>
            <tr>
                                <?php
                                for ($i=0;$i<23;$i++) {
                                    echo '<td style="width:65px; height: 5px;"></td>';
                                }
                                ?>
            </tr>
                            <?php
                        }
                    }
                    ?>
        </table>
        <!-- legenda -->
        <table>
                    <?php
                    for ($l=1;$l<count($hodnoty3);$l++) {
                        echo '<tr><td>';
                        if (file_exists("images/".$hodnoty2[$l].".png")) {
                            echo '<img src="images/'.$hodnoty2[$l].'.png" title="" alt="" width="70" height="20" />';
                        } else {

                        }
                        echo '</td><td>'.$hodnoty3[$l].'</td></tr>';
                    }
                    ?>
        </table>
        <!-- koniec legendy -->

                <?php
            }
        }
        ?>



        <script language="JavaScript"  TYPE="text/Javascript">
            javascript:print('')
        </script>
    </body>
</html>